package com.example.controller;

import com.example.entity.Article;
import com.example.entity.Comment;
import com.example.repository.ArticleRepository;
import com.example.repository.CommentRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/comment")
public class CommentController {

    @Autowired
    private CommentRepository commentRepository;

    @Autowired
    private ArticleRepository articleRepository;

    @RequestMapping("/findArticleByComment")
    public List<Comment> findArticleByComment(){

        List<Comment> commentByArticle = commentRepository.findArticleByComment();
        System.out.println(commentByArticle);

        return commentByArticle;
    }
}
